<div class="layuimini-container layuimini-page-anim">
    <div class="layuimini-main">

        <!--<fieldset class="table-search-fieldset">
            <legend>搜索信息</legend>
            <div style="margin: 10px 10px 10px 10px">
                <form class="layui-form layui-form-pane" action="">
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">学生姓名</label>
                            <div class="layui-input-inline">
                                <input type="text" name="key" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <button class="layui-btn layuiadmin-btn-list" lay-submit lay-filter="search-submit">
                                <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                            </button>
                        </div>
                    </div>
                </form>
            </div>
        </fieldset>-->
        <!--        toolbarDemo就是头部工具栏的id-->
        <script type="text/html" id="toolbarDemo">

        </script>

        <table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>


    </div>
</div>

<script>
    layui.use(['form', 'table','miniPage','element','upload','store'], function () {
        var $ = layui.jquery,
            form = layui.form,
            table = layui.table,
            upload = layui.upload,
            store = layui.store,
            miniPage = layui.miniPage;

        table.render({
            elem: '#currentTableId',
            id: 'currentTableId',//重载需要
            url: '/absence/getList',
            method: 'post',
            toolbar: '#toolbarDemo',
            defaultToolbar: ['filter','exports', 'print'], //头部工具栏
            cols: [[
                {type: "checkbox", width: 50},
                {type: 'numbers', title: 'ID', sort: true},
                {field: 'sno', title: '学号',sort: true, width:135},
                {field: 'studentName', title: '学生姓名',sort: true},
                {field: 'time', title: '缺席时间',sort: true},
                {field: 'buildingName', title: '楼宇名',sort: true},
                {field: 'dormitoryNo', title: '宿舍',sort: true},
                {field: 'remark', title: '备注'},
                {title: '操作', minWidth: 150, toolbar: '#currentTableBar', align: "center"}
            ]],
            limits: [5, 10, 15, 20, 25, 50, 100],
            limit: 5,
            skin: 'line',
            page: true,//开启分页
            parseData: function (res) { //res 即为原始返回的数据
                return {
                    "code": res.code, //解析接口状态
                    "msg": res.message, //解析提示文本
                    "count": res.data.count, //解析数据长度
                    "data": res.data.records //解析数据列表
                };
            }
        });
        // 监听搜索操作
        form.on('submit(search-submit)',function (data) {
            table.reload('currentTableId',{
                where:{
                    "key":data.field.key
                }
            });
            return false;
        });

    });
</script>